package top.maof.book.rank.book;

import lombok.Data;
import lombok.ToString;
import top.maof.book.rank.KeyProperty;
import top.maof.book.rank.Page;
import top.maof.book.type.HotType;

import java.io.Serializable;
import java.util.Calendar;


/**
 * 属性定义的先后位置请勿随意移动,否则会导致key的生成
 * 前后不一致
 */
@Data
@ToString
public class BookPage extends Page implements Serializable, Cloneable {

    private String sourceSite;

    private String classify;

    private String state;

    private Integer year;
    private Integer month;
    private Integer week;
    private Integer day;

    @KeyProperty(ignore = true)
    private HotType hotType;


    public void initTime() {
        Calendar calendar = Calendar.getInstance();
        this.year = calendar.get(Calendar.YEAR);
        this.month = calendar.get(Calendar.MONTH + 1);
        this.week = calendar.get(Calendar.WEEK_OF_MONTH);
        this.day = calendar.get(Calendar.DAY_OF_MONTH);
    }
}
